package com.sectop.bank;

import com.sectop.bank.domain.OverdraftException;

public class Account {
    protected double balance;


    public Account() {
    }

    public Account(double balance) {
        this.balance = balance;
    }

    public double getBalance() {
        return balance;
    }

    //提现
    public void withDraw(double money) throws OverdraftException {

        if(this.balance - money < 0){
            throw  new OverdraftException("资金不足",money);
        }else {
            this.balance -= money;
//            return true;
        }
    }

    public boolean deposit(double money){
        this.balance = balance + money;
         return true;


    }
}
